<?php

namespace Xin\Coze\Providers;

class ConversationProvider extends AbstractProvider
{
	/**
	 * 创建会话
	 * @param array $messages
	 * @param array $metaData
	 * @param array $options
	 * @return array|null
	 */
	public function create(array $messages = [], array $metaData = [], array $options = [])
	{
		return $this->coze->httpPost('/v1/conversation/create', [
			'messages' => $messages,
			'meta_data' => $metaData ?: new \stdClass(),
		], $options);
	}

	/**
	 * 获取会话消息
	 * @param string $conversationId
	 * @param array $options
	 * @return array|null
	 */
	public function messages(string $conversationId, array $options = [])
	{
		return $this->coze->httpGet("/v1/conversation/retrieve", [
			'conversation_id' => $conversationId,
		], $options);
	}
}
